package www.tshu.servlet.admin;

import www.tshu.pojo.Book;
import www.tshu.service.BookService;
import www.tshu.service.impl.BookServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/ServletSelectBook")
public class ServletSelectBook extends HttpServlet {
    private BookService bookService =new BookServiceImpl();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req,resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String bid = req.getParameter("bid");
        List<Book>blist = bookService.selectBook(bid);
        req.setAttribute("blist",blist);
        req.getRequestDispatcher("/admin/editBook.jsp").forward(req,resp);
    }
}
